
//添加,修改
query_add=function(op,cname,remark,cid,pid){
	var tips=$("#_div_result");
	var url = iyun_interface('sortclass'); 
	if(check_input_num()){
		postJson(url,{ op:op,cname:cname,remark:remark,cid:cid,pid:pid},function(json){
			if(json.result != 0){
				alert(json.msg);
			}else{
				alert(json.msg);
				location.href="system.php?action=key";
			}
		});		
	}
}
//删除
query_del=function(op,key,cid){
	var url = iyun_interface('sortclass'); 
	if(confirm("你确定删除,该操作不可恢复?")){postJson(url,{ op:op,key:key,cid:cid},function(json){
		if(json.result != 0){
			tips.show();
			tips.html(json.msg);
		}else{
			alert(json.msg);
			location.href="system.php?action=key";
		}
	});
	}		
	
}
//移动
query_move=function(op,who,to){
	var url = iyun_interface('sortclass'); 
		postJson(url,{ op:op,who:who,to:to},function(json){
			if(json.result != 0){
				tips.show();
				tips.html(json.msg);
			}else{
				alert(json.msg);
				location.href="system.php?action=key";
			}
		});		
}
check_input_num=function(){
	var op=$("#op").val();
	var cname=$("#cname").val();
	var key=$("#key").val();
	var remark=$("#remark").val();
	var tips=$("#_div_result");
	if(op=="" && op!="undefined"){tips.show();tips.html("请选择操作类型");return false;};
	if(cname==""){tips.show();tips.html("请输入名称");return false;};
	if(key==""){tips.show();tips.html("请输入KEY");return false;};
	if(remark==""){tips.show();tips.html("请输入备注");return false;};
	return true;
}

